<template>
    <div id="movie">
      <Header></Header>
      <!--导航-->
      <ul class="nav clearfix">
        <li>
          <span>全城</span>
          <van-icon name="arrow-down" />
        </li>
        <li>
          <span>品牌</span>
          <van-icon name="arrow-down" />
        </li>
        <li>
          <span>特色</span>
          <van-icon name="arrow-down" />
        </li>
      </ul>
      <!--电影院数据-->
      <ul class="mlist">
        <li v-for="item in movies">
          <!--电影院名及价格-->
          <div>{{item.nm}} <span class="price"><span>{{item.sellPrice}}</span>元起</span></div>
          <!--地址-->
          <div class="address">{{item.addr}}</div>
          <!--特色-->
          <div class="card">
            <span v-if="item.tag.endorse == 1" class="endorse">改签</span>
            <span v-if="item.tag.allowRefund == 1" class="allowRefund">退</span>
            <span v-if="item.tag.vipTag == '折扣卡'" class="vipTag">折扣卡</span>
            <span v-if="item.tag.snack == 1" class="snack">小吃</span>
          </div>
        </li>
      </ul>
      <Tabbar></Tabbar>
    </div>
</template>

<!--
  allowRefund:退
  endorse：改签
  snack：小吃
  vipTag：'折扣卡'
-->

<script>

import Tabbar from '@/components/Tabbar.vue'
import Header from '@/components/Header.vue'

export default {
      name: "Movie",
      data(){
        return{
          movies:[],//影院信息数据
        }
      },
      created(){
        this.movieList();
        const params = {
          
        }
        this.axios.get('/music/search?keywords= 夏日倾情&type=1006').then(res=>{
            console.log(res)
        })
      },
      components: {
        Tabbar,
        Header

      },
      methods:{
          //获取影院数据
          movieList(){
            const params = {
              //刷新页面时 vuex数据会丢失，所以使用存到sessionStorage里面的数据
              cityId:this.$store.state.names.id?this.$store.state.names.id:JSON.parse(sessionStorage.getItem('names'))['id'],
            }
            this.axios.get('/hai/cinemaList',{params:params}).then(res =>{
              this.movies = res.data.data.cinemas;
            })
          }
      }
}
</script>

<style scoped lang="less">
  #movie{
    header{
      position: fixed;
      width: 100%;
      top: 0;
      z-index: 9999;
    }
    .mlist{
      flex: 1;
      overflow: auto;
      padding: 10px 20px 10px 20px;
      text-align: left;
      margin-top: 90px;
      li{
        border-bottom: 1px solid #e6e6e6;
        margin-bottom: 20px;
        div{
          margin-bottom: 10px;
          .price{
            color: #f03d37;
            span{
              font-size: 18px;
              padding-right: 3px;
            }
          }
        }
        .address{
          font-size: 12px;
          color: #666;

        }
        .card{
          span{
            margin-left: 5px;
          }
          span:nth-of-type(1){
            margin-left: 0;
          }
          .allowRefund{
            color: #589daf;
            border: 1px solid #589daf;
          }
          .snack{
            color: #f90;
            border: 1px solid #f90;
          }
          .endorse{
            color: #589daf;
            border: 1px solid #589daf;
          }
          .vipTag{
            color: #f90;
            border: 1px solid #f90;
          }
        }
      }
    }
    .nav{
      height: 40px;
      line-height: 40px;
      text-align: center;
      border-bottom: 1px solid #e6e6e6;
      position: fixed;
      top: 50px;
      width: 100%;
      background: #fff;
      li{
        float: left;
        width: 33.333%;
        span{
          font-weight: 600;
          padding-right: 1px;
        }
      }
    }
  }
</style>
